package com.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.controller.TestController.User;

/**
 * @author 贺瑞杰
 * @date 2018年8月1日 下午3:18:22
 * @version V1.0
 * @Description
 */
@Controller
public class TestController {

	@RequestMapping("index")
	public String toIndex() {
		return "index";
	}

	@RequestMapping("queryUserAll")
	@ResponseBody
	public List<User> queryUserAll() {
		ArrayList<User> list = new ArrayList<TestController.User>();
		list.add(new User(1,"小马哥"));
		list.add(new User(2,"老马哥"));
		return list;
	}

	class User {
		private Integer id;
		private String name;

		public Integer getId() {
			return id;
		}

		public void setId(Integer id) {
			this.id = id;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}

		public User(Integer id, String name) {
			super();
			this.id = id;
			this.name = name;
		}
		
	}
}
